# -*- codeing = utf-8 -*-
# @Time : 2021/2/27 22:54
# @Atuthor: 朱朱
# @File: 147finally注意事项.py
# @Software: PyCharm

def test(a,b):
    x = a+b
    return x # 执行return,表示函数结束,后面的不会执行
    return 'hello'

def demo(a,b):
    try:
        x = a /b
    except Exception as e:
        return e
    else:
        return x
    finally:
        print('我是finally')


print(demo(1, 2))
print('---------------')
print(demo(1, 0)) # division by zero
# # 如果函数里有finally,finally里的返回值会覆盖之前的返回值
